﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Autocentro.Entities;

namespace Autocentro.Respository.Mapping
{
    public class ServicioMap : EntityTypeConfiguration<SERVICIO>
    {
        public ServicioMap()
        {
            this.HasKey(s => s.Id);

            this.Property(s => s.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(c => c.Descripcion)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(c => c.Precio)
                .IsOptional()
                .HasPrecision(9, 2);

            this.ToTable("SERVICIO");
            this.Property(c => c.Id).HasColumnName("Id");
            this.Property(c => c.Precio).HasColumnName("Precio");
            this.Property(c => c.Descripcion).HasColumnName("Descripcion");

        }
    }
}
